home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Games / JST / sources / jst / gp_macros.i next >
Encoding:
Text File  |  2001-03-19  |  17.0 KB  |  632 lines

  1.     IFND    GP_MACROS_I_INCLUDED
  2. GP_MACROS_I_INCLUDED    =    1
  3.  
  4.     ;MC68000
  5.  
  6. ; ** JST version identifier (to avoid the use of obsolete versions)
  7.  
  8. CURRENT_VERSION_ID = 20
  9.  
  10. ; ** currently used disk sizes
  11.  
  12. STD_DISK_SIZE = 901120    ; standard dos copiable disks
  13. B12_DISK_SIZE = 970752    ; 12 sectored 79 tracks disks, dos bootblock
  14. S12_DISK_SIZE = 983040    ; 12 sectored 79 tracks disks, dos bootblock
  15.  
  16. ; ** Tooltype/argument definitions
  17.  
  18. ; bits
  19.  
  20. AFB_NTSC = 0
  21. AFB_LOWMEM = 1
  22. AFB_HDLOAD = 2
  23. AFB_TRAINER = 3
  24. AFB_NOOSSWAP = 4
  25. AFB_JOYPAD = 5
  26.  
  27. ; ** joypad button definitions (for JoyButtonsState)
  28.  
  29. ; ** masks
  30.  
  31. AFF_FIRE1 = $20        ; red joypad button
  32. AFF_START = $01        ; start/pause joypad button
  33. AFF_FIRE2 = $40        ; blue joypad button
  34. AFF_FIRE4 = $08        ; green joypad button
  35. AFF_FIRE3 = $10        ; yellow joypad button
  36. AFF_FORWD = $04        ; forward joypad key
  37. AFF_BACWD = $02        ; back joypad key
  38.  
  39. ; ** bits
  40.  
  41. AFB_START = $0        ; start/pause joypad button
  42. AFB_BACWD = $1        ; back joypad key
  43. AFB_FORWD = $2        ; forward joypad key
  44. AFB_FIRE4 = $3        ; green joypad button
  45. AFB_FIRE3 = $4        ; yellow joypad button
  46. AFB_FIRE1 = $5        ; red joypad button
  47. AFB_FIRE2 = $6        ; blue joypad button
  48.  
  49.  
  50. STORE_REGS: MACRO
  51.     IFLE    NARG
  52.     movem.l    D0-D7/A0-A6,-(A7)
  53.     ELSE
  54.     movem.l    \1,-(A7)
  55.     ENDC
  56.     ENDM
  57.  
  58. RESTORE_REGS: MACRO
  59.     IFLE    NARG
  60.     movem.l    (A7)+,D0-D7/A0-A6
  61.     ELSE
  62.     movem.l    (A7)+,\1
  63.     ENDC
  64.     ENDM
  65.  
  66. WAIT_LMB: MACRO
  67. .wl\@
  68.     btst    #6,$BFE001
  69.     bne    .wl\@
  70.     ENDM
  71.  
  72. WAIT_JOY: MACRO
  73. .wj\@
  74.     btst    #7,$BFE001
  75.     bne    .wj\@
  76.     ENDM
  77.  
  78. GETLVO:MACRO
  79.     move.l    #_LVO\1,D0
  80.     ENDM
  81.  
  82. ; ******* Print/Printf ********
  83. ; Because of buggy Barfly macro argument count,
  84. ; I had to make 2 functions for BARFLY for each Mac_printf and Mac_printh
  85. ;
  86. ; Mac_printf : same as before
  87. ; Mac_print  : no linefeed (same as Mac_printf "string",*anything* , except
  88. ; Barfly does not work properly with it, and as I now use Barfly for JST
  89. ; it's annoying)
  90. ;
  91. ; Mac_printh : same as before
  92. ; Mac_printx : Mac_printh without linefeed
  93.  
  94.     IFD    BARFLY
  95.  
  96. Mac_print: MACRO
  97.  
  98.     move.l    A1,-(A7)
  99.     lea    .text\@(PC),A1
  100.     JSRABS    Display
  101.  
  102.     bra.b    .ftext\@
  103. .text\@
  104.     dc.b    '\1',0
  105.     even
  106.  
  107. .ftext\@
  108.     move.l    (A7)+,A1
  109.     ENDM
  110.  
  111. Mac_printf: MACRO
  112.     Mac_print    <\1>
  113.     NEWLINE
  114.     ENDM
  115.  
  116. Mac_printh: MACRO
  117.     Mac_printx    \1
  118.     NEWLINE
  119.     ENDM
  120.  
  121. Mac_printx:MACRO
  122.     movem.l    D0/A1,-(A7)
  123.     move.l    \1,D0
  124.     lea    .text\@(PC),A1
  125.     JSRABS    HexToString
  126.     JSRABS    Display
  127.     bra.b    .ftext\@
  128.  
  129. .text\@
  130.     dc.b    "$00000000",0
  131.     even
  132. .ftext\@
  133.     movem.l    (A7)+,D0/A1
  134.     ENDM
  135.  
  136.     ELSE
  137.  
  138. ; *** macro definitions for other assemblers than Barfly
  139.  
  140. ; ******* Macro Printf ********
  141. ; Mac_printf "text"   -> text + linefeed
  142. ; Mac_printf "text",*any argument* -> text without linefeed
  143.  
  144. Mac_printf: MACRO
  145.  
  146.     move.l    A1,-(A7)
  147.     lea    .text\@(PC),A1
  148.     JSRABS    Display
  149.     bra.b    .ftext\@
  150. .text\@
  151.     IFD    MAXON_ASM
  152.         dc.b    "\1"
  153.     ELSE
  154.         IFD    BARFLY
  155. ;;            dc.b    "\1"
  156.         ELSE
  157.             DC.B    \1
  158.         ENDIF
  159.     ENDIF
  160.     
  161.     IFLE    NARG-1
  162.     dc.b    10,13
  163.     ENDC
  164.     dc.b    0
  165.     even
  166.  
  167. .ftext\@
  168.     move.l    (A7)+,A1
  169.     ENDM
  170.  
  171. Mac_print:MACRO
  172.     Mac_printf    '\1',v
  173.     ENDM
  174.  
  175. ; ******* Macro Printh ********
  176. ; Mac_printh <expr>   -> hex number + linefeed
  177. ; Mac_printh <expr>,*any argument* -> without linefeed
  178.  
  179. Mac_printh: MACRO
  180.  
  181.     movem.l    D0/A1,-(A7)
  182.     move.l    \1,D0
  183.     lea    .text\@(PC),A1
  184.     JSRABS    HexToString
  185.     JSRABS    Display
  186.     bra.b    .ftext\@
  187.  
  188. .text\@
  189.     dc.b    "$00000000"
  190.     IFLE    NARG-1
  191.     dc.b    10,13
  192.     ENDC
  193.     dc.b    0
  194.     even
  195. .ftext\@
  196.     movem.l    (A7)+,D0/A1
  197.     ENDM
  198.  
  199.     ENDC
  200.  
  201. PUTS: MACRO
  202.     move.l    A1,-(A7)
  203.     lea    \1,A1
  204.     JSRABS    Display
  205.     move.l    (A7)+,A1
  206.     ENDM
  207.  
  208. NEWLINE: MACRO
  209.     JSRABS    NewLine
  210.     ENDM
  211.  
  212.  
  213.  
  214. STOP_SOUND:MACRO
  215.     move.w    #$000F,dmacon+$DFF000
  216.     move.w    #$0000,aud0+ac_len+$DFF000
  217.     move.w    #$0000,aud1+ac_len+$DFF000
  218.     move.w    #$0000,aud2+ac_len+$DFF000
  219.     move.w    #$0000,aud3+ac_len+$DFF000
  220.     ENDM
  221.  
  222.     ; *** Non-relocated routines. call normally with JSR
  223.     ; *** don't call them with JSRGEN, this would not compile (better than crash)
  224.  
  225. MAKE_ABS_REFS:MACRO
  226.  
  227.     DEF_\1_ABS    CloseAll,0        ; quit program (while the OS is up)
  228.     DEF_\1_ABS    CloseAllQuiet,1        ; quit program and close window
  229.     DEF_\1_ABS    LoadDisks,2        ; load diskfiles
  230.     DEF_\1_ABS    LoadDiskFromName,3    ; load a disk
  231.     DEF_\1_ABS    LoadDisksIndex,4    ; load a disk, starting from number D0
  232.     DEF_\1_ABS    LoadFiles,5        ; load files in the directory
  233.     DEF_\1_ABS    LoadSmallFiles,6    ; load small files (<D0)
  234.     DEF_\1_ABS    Kick37Test,7        ; check if Kickstart version <37
  235.     DEF_\1_ABS    KickVerTest,8        ; check against a given kick version
  236.     DEF_\1_ABS    GetMemFlag,9        ; returns MEMF_REVERSE flag isf available
  237.     DEF_\1_ABS    FlushCachesSys,10    ; flush caches using CacheClearU()
  238.     DEF_\1_ABS    Enhance,11        ; restores everything (caches, display)
  239.     DEF_\1_ABS    Degrade,12        ; degrades everything
  240.     DEF_\1_ABS    Unsupported1,13        ; future use
  241.     DEF_\1_ABS    Unsupported2,14        ; future use
  242.     DEF_\1_ABS    TransfRoutines,15    ; *** obsolete ***
  243.     DEF_\1_ABS    SaveOSData,16        ; saves OS data (mem,CIAs,custom...)
  244.     DEF_\1_ABS    TestFile,17        ; check if a file is here (game path)
  245.     DEF_\1_ABS    Display,18        ; display a string pointed by A1
  246.     DEF_\1_ABS    LoadRNCFile,19        ; load a RNC file and unpack it
  247.     DEF_\1_ABS    AllocExtMem,20        ; allocate extension memory
  248.     DEF_\1_ABS    Test1MBChip,21        ; check against 1MB of chip (at least)
  249.     DEF_\1_ABS    Test2MBChip,22        ; check against 2MB of chip
  250.     DEF_\1_ABS    Reboot,23        ; reboots :-), only works when OS is alive!
  251.     DEF_\1_ABS    WaitReturn,24        ; waits for the user to press return key
  252.     DEF_\1_ABS    BlockFastMem,25        ; * allocates all fastmem. Do not use :-)
  253.     DEF_\1_ABS    CheckFastMem,26        ; checks if the computer has got fast memory
  254.     DEF_\1_ABS    SupervisorMode,27    ; goes into supervisor mode
  255.     DEF_\1_ABS    UserMode,28        ; goes into user mode
  256.     DEF_\1_ABS    Alloc24BitMem,29    ; allocate extension memory, 24 bit area only
  257.     DEF_\1_ABS    OpenFakeExec,30        ; allocate table for fake exec (obsolete, will exit)
  258.     DEF_\1_ABS    SetFilesPath,31        ; change default file path
  259.     DEF_\1_ABS    TestDirectory,32    ; test directory presence (game path)
  260.     DEF_\1_ABS    TestDirectoryAbs,33    ; test directory presence (absolute path)
  261.     DEF_\1_ABS    TestFileAbs,34        ; test file presence (absolute path)
  262.     DEF_\1_ABS    SetLocalVarZone,35    ; save start-end of local object variables
  263.     DEF_\1_ABS    InitLogPatch,36        ; initialize patch logging (private function)
  264.     DEF_\1_ABS    TestAssign,37        ; test assign presence
  265.     DEF_\1_ABS    AllocateTheMemory,38    ; AllocMem with ressource-tracking
  266.     DEF_\1_ABS    FreeTheMemory,39    ; AllocMem with ressource-tracking
  267.     DEF_\1_ABS    HexToString,40        ; HexToString, absolute call
  268.     DEF_\1_ABS    UseHarryOSEmu,41    ; Tell JST to use Harry's great OS emu
  269.     DEF_\1_ABS    NewLine,42        ; Prints a newline
  270.     DEF_\1_ABS    DisableChipmemGap,43    ; Will allow LOWMEM with 2MB chip
  271.     DEF_\1_ABS    GetFileLength,44    ; Returns the length of a file on disk
  272.     
  273.     DEF_\1_ABS    Unsupported9,45        ; future use
  274.     DEF_\1_ABS    Unsupported3,46        ; future use
  275.     DEF_\1_ABS    Unsupported4,47        ; future use
  276.     DEF_\1_ABS    Unsupported5,48        ; future use
  277.     DEF_\1_ABS    Unsupported6,49        ; future use
  278.     DEF_\1_ABS    Unsupported7,50        ; future use
  279.     DEF_\1_ABS    Unsupported8,51        ; future use
  280.  
  281.     ENDM
  282.     
  283.     ; *** Relocated routines. always call with JSRGEN (see macros.i)
  284.     ; *** from user program. It works with JSR but if the OS is killed
  285.     ; *** JSRGEN is safer as it jumps in the allocated block
  286.     ; *** which is in the top of memory (MEMF_REVERSE) if kick > 38
  287.     ; *** fast memory is used when found, else chipmem is used
  288.     ; ***
  289.     ; *** I also included a short description of the routines
  290.     ; *** Please read the autodocs to get more details
  291.     
  292.     ; *** The functions marked with a * should not be used anymore
  293.  
  294. MAKE_REL_REFS:MACRO
  295.     DEF_\1_REL    GetSR,0            ; returns SR in D0
  296.     DEF_\1_REL    GoECS,1            ; useless - resets sprite aspect/playfield/goes 15KHz
  297.     DEF_\1_REL    GetAttnFlags,2        ; gets system backuped AttnFlags, at any time
  298.     DEF_\1_REL    ResetDisplay,3        ; switches in PAL or NTSC if specified
  299.     DEF_\1_REL    ResetSprites,4        ; resets sprite aspect, useless, dummy!
  300.     DEF_\1_REL    BlackScreen,5        ; sets all color registers to black
  301.     DEF_\1_REL    JoypadState,6        ; to check the state of joystick/joypad
  302.     DEF_\1_REL    InitTrackDisk,7        ; returns a fake disk IO pointer in A1
  303.     DEF_\1_REL    TrackLoad,8        ; simulates DoIO()
  304.     DEF_\1_REL    TrackLoadFast,9        ; * same routine. Please use the TrackLoad name
  305.     DEF_\1_REL    SetTDUnit,10        ; sets drive unit in D0 (for DoIO emulation)
  306.     DEF_\1_REL    SetDisk,11        ; sets current disk (useful with HDLOAD)
  307.     DEF_\1_REL    ReadRobSectors,12    ; reads sectors, rob northen interface
  308.     DEF_\1_REL    ReadRobSectorsFast,13    ; * same routine. Use ReadRobSectors instead
  309.     DEF_\1_REL    ReadFile,14        ; reads file, rob northen interface, from RAM or HD
  310.     DEF_\1_REL    ReadFileFast,15        ; reads file, rob northen interface, from RAM only
  311.     DEF_\1_REL    ReadFilePartHD,16    ; partially reads file, modified rob northen interface, from HD only
  312.     DEF_\1_REL    ReadDiskPart,17        ; reads parts of a disk, from RAM or HD (LOWMEM decides)
  313.     DEF_\1_REL    ReadFileHD,18        ; reads file, rob northen interface, from HD only
  314.     DEF_\1_REL    WriteFileHD,19        ; writes file on HD during game
  315.     DEF_\1_REL    DeleteFileHD,20        ; deletes file from HD during game (careful :-))
  316.     DEF_\1_REL    PPDecrunch,21        ; decrunches PowerPacker files/blocks
  317.     DEF_\1_REL    ImploderDecrunch,22    ; decrunches Imploder files/blocks
  318.     DEF_\1_REL    ATNDecrunch,23        ; decrunches ATN! files/blocks
  319.     DEF_\1_REL    RNCDecrunch,24        ; decrunches RNC\01,\02 files/blocks
  320.     DEF_\1_REL    FungusDecrunch,25    ; decrunches Gremlins packer files/blocks
  321.     DEF_\1_REL    RNCDecrunchEncrypted,26    ; decrunches RNC/01 encrypted files/blocks
  322.     DEF_\1_REL    RNCLength,27        ; gives the length of decunched RNC file
  323.     DEF_\1_REL    FlushCachesHard,28    ; flushes all caches
  324.     DEF_\1_REL    WaitBlit,29        ; waits till blitter operation is complete
  325.     DEF_\1_REL    BeamDelay,30        ; waits using $DFF006 register (beam)
  326.     DEF_\1_REL    InGameOSCall,31        ; calls a user OS routine during the game
  327.     DEF_\1_REL    PatchExceptions,32    ; private - install JOTD exception handler (only exceptions)
  328.     DEF_\1_REL    StrcmpAsm,33        ; compares 2 strings (null termintated). Not case sensitive
  329.     DEF_\1_REL    StrcpyAsm,34        ; copies a string (null terminated)
  330.     DEF_\1_REL    StrlenAsm,35        ; returns length of a string (ends with null)
  331.     DEF_\1_REL    ToUpperAsm,36        ; converts a string in upper case
  332.     DEF_\1_REL    WaitMouse,37        ; waits for LMB to be pressed. Colors fill the screen
  333.     DEF_\1_REL    WaitMouseInterrupt,38    ; same thing but interrupts are enabled (HRTMon)
  334.     DEF_\1_REL    GetDiskPointer,39    ; gets start of the specified diskfile (D0) (can be avoided)
  335.     DEF_\1_REL    CheckAGA,40        ; checks if the computer is AGA using DeniseId
  336.     DEF_\1_REL    SetExitRoutine,41    ; to call a user routine just before exit
  337.     DEF_\1_REL    InGameExit,42        ; exits to WB from game at any time
  338.     DEF_\1_REL    SaveCustomRegs,43    ; private - saves important custom registers
  339.     DEF_\1_REL    RestoreCustomRegs,44    ; private - restores them
  340.     DEF_\1_REL    SaveCIARegs,45        ; private - saves all CIA info possible and LED state
  341.     DEF_\1_REL    RestoreCIARegs,46    ; private - restores them
  342.     DEF_\1_REL    FreezeAll,47        ; clears all ints, dma...
  343.     DEF_\1_REL    ReadUserFileHD,48    ; reads file, from HD in user SAVEDIR directory
  344.     DEF_\1_REL    WriteUserFileHD,49    ; writes file on HD in user SAVEDIR directory
  345.     DEF_\1_REL    DeleteUserFileHD,50    ; removes file from HD in user SAVEDIR directory
  346.     DEF_\1_REL    TPWMDecrunch,51        ; decrunches TPWM files/blocks (experimental)
  347.     DEF_\1_REL    WaitBOF,52        ; waits bottom of frame, hardware coded. not working, useless
  348.     DEF_\1_REL    ReadUserDir,53        ; reads user directory in a robdir structure
  349.     DEF_\1_REL    PatchZeroPage,54    ; private - install JOTD exception handler (done in SaveOSData)
  350.     DEF_\1_REL    FireDecrunch,55        ; decrunch FIRE packer files/blocks
  351.     DEF_\1_REL    HexReplaceLong,56    ; search/replace a longword in a zone
  352.     DEF_\1_REL    HexReplaceWord,57    ; search/replace a word in a zone
  353.     DEF_\1_REL    HexToDecString,58    ; converts hexadecimal to decimal string
  354.     DEF_\1_REL    GetUserData,59        ; returns userdata string
  355.     DEF_\1_REL    StrncpyAsm,60        ; strncpy, D2 limits string length
  356.     DEF_\1_REL    PatchMoveCList_Idx,61    ; patches move.l #adr,($80,Ax) 
  357.     DEF_\1_REL    StoreCopperPointer,62    ; stores manually copper address
  358.     DEF_\1_REL    TellCopperPointer,63    ; returns previously stored copper address
  359.     DEF_\1_REL    InGameIconify,64    ; iconifies the game
  360.     DEF_\1_REL    PatchMoveCList_Abs,65    ; patches move.l #adr,($DFF080) 
  361.     DEF_\1_REL    PatchMoveCList_Ind,66    ; patches move.l adr,($DFF080) 
  362.     DEF_\1_REL    LogPatch,67        ; store before-patch information
  363.     DEF_\1_REL    PatchMoveBlit_Idx,68    ; patches move.w #blit,($58,Ax)
  364.     DEF_\1_REL    HexToString,69        ; hex to string conversion
  365.     DEF_\1_REL    IsRegistered,70        ; check to see if JST is registered
  366.     DEF_\1_REL    SetQuitKey,71        ; set the key for auto quit
  367.     DEF_\1_REL    SetIconifyKey,72    ; set the key for auto iconify
  368.     DEF_\1_REL    ReadFilePart,73        ; partially reads file, modified rob northen interface
  369.     DEF_\1_REL    StrncmpAsm,74        ; partially compares 2 strings UC=LC
  370.     DEF_\1_REL    CRC16,75        ; calculates CRC16 for a block
  371.     DEF_\1_REL    TSMDecrunch,76        ; decrunches a TSM! file, not working!
  372.     DEF_\1_REL    EnterDebugger,77    ; enter your Debugger/Freezer if any present
  373.     DEF_\1_REL    ReadFileFromImage,78    ; Load a file from a "DOS\0" image
  374.     DEF_\1_REL    EnableMMU,79        ; private - Enable the MMU translation
  375.     DEF_\1_REL    DisableMMU,80        ; private - Disable the MMU translation
  376.     DEF_\1_REL    SetTraceVector,81    ; Modifies trace vector ($24.W+VBR)
  377.     DEF_\1_REL    GetUserFlags,82        ; Gets some of the user tooltypes
  378.     DEF_\1_REL    InstallHarryOSEmu,83    ; private - do not use
  379.     DEF_\1_REL    AddPart,84        ; concatenates dirname[/:]filename
  380.     DEF_\1_REL    CopyMem,85        ; copies memory
  381.     DEF_\1_REL    RelocateExecutable,86    ; relocates executable
  382.     DEF_\1_REL    ExeSegmentLength,87    ; calculates executable filesize
  383.     DEF_\1_REL    ExeMappedLength,88    ; calculates expanded size in memory
  384.     DEF_\1_REL    OSEmuRelocate,89    ; relocates executable, with allocation
  385.     DEF_\1_REL    HexSearch,90        ; memory search
  386.     DEF_\1_REL    SkipColon,91        ; skips ':' in file names
  387.     DEF_\1_REL    RestoreCustomNoDMA,92    ; private
  388.     DEF_\1_REL    SetRTFileError,93    ; sets/disables runtime file error
  389.     DEF_\1_REL    ATNLength,94        ; ATN/IMP length
  390.  
  391.     DEF_\1_REL    Priv_SetLed,95        ; private
  392.     DEF_\1_REL    Priv_GetLed,96        ; private
  393.  
  394.     DEF_\1_REL    Priv_SearchDirEntry,97    ; private
  395.     DEF_\1_REL    Priv_WHDStart,98    ; private
  396.     DEF_\1_REL    SetBusErrorVector,99    ; Modifies bus error vector ($8.W+VBR)
  397.     DEF_\1_REL    Priv_EndSaveOsData,100    ; private
  398.     DEF_\1_REL    TryUnpackedSupport,101    ; Try to support unpacked files
  399.     DEF_\1_REL    Priv_RegisterBusErrorRoutine,102    ; private
  400.     DEF_\1_REL    ShortHexToString,103    ; word hex to string conversion
  401.     DEF_\1_REL    SetAfterSwitchFunction,104    ; Called after OS swap
  402.     DEF_\1_REL    GetLoadDir,105        ; returns LOADDIR string or NULL in A0
  403.     DEF_\1_REL    TraceControl,106    ; sets/disables trace mode
  404.     DEF_\1_REL    GetObjectType,107    ; gets object type
  405.     DEF_\1_REL    GetOSEmuBase,108    ; returns OSEmu base in A0 (usually $400)
  406.     DEF_\1_REL    Unsupported8,109    ; future use
  407.     DEF_\1_REL    Unsupported9,110    ; future use
  408.     DEF_\1_REL    Unsupported2,111    ; future use
  409.     
  410.     ENDM
  411.  
  412. DUMMY_MACRO:MACRO
  413.     ;dummy due asm-one-problem
  414.     dc.b    \1
  415.     ENDM
  416.  
  417. DEF_OFFSET_ABS:MACRO
  418. AbsOff_\1 = \2*4
  419.     ENDM
  420.  
  421. DEF_OFFSET_REL:MACRO
  422. RelOff_\1 = \2*4
  423.     ENDM
  424.  
  425.  
  426. RELOC_CLRL:MACRO
  427.     IFNE    NARG-1
  428.         FAIL    arguments "RELOC_CLRL"
  429.     ENDC
  430.  
  431.     RELOC_MOVEL    #0,\1
  432.     ENDM
  433.  
  434. RELOC_CLRW:MACRO
  435.     IFNE    NARG-1
  436.         FAIL    arguments "RELOC_CLRW"
  437.     ENDC
  438.  
  439.     RELOC_MOVEW    #0,\1
  440.     ENDM
  441.  
  442. RELOC_CLRB:MACRO
  443.     IFNE    NARG-1
  444.         FAIL    arguments "RELOC_CLRB"
  445.     ENDC
  446.  
  447.     RELOC_MOVEB    #0,\1
  448.     ENDM
  449.  
  450. RELOC_STL:MACRO
  451.     IFNE    NARG-1
  452.         FAIL    arguments "RELOC_STL"
  453.     ENDC
  454.  
  455.     RELOC_MOVEL    #-1,\1
  456.     ENDM
  457.  
  458. RELOC_STW:MACRO
  459.     IFNE    NARG-1
  460.         FAIL    arguments "RELOC_STW"
  461.     ENDC
  462.  
  463.     RELOC_MOVEW    #-1,\1
  464.     ENDM
  465.  
  466. RELOC_STB:MACRO
  467.     IFNE    NARG-1
  468.         FAIL    arguments "RELOC_STB"
  469.     ENDC
  470.  
  471.     RELOC_MOVEB    #-1,\1
  472.     ENDM
  473.  
  474. RELOC_MOVEL:MACRO
  475.     IFNE    NARG-2
  476.         FAIL    arguments "RELOC_MOVEL"
  477.     ENDC
  478.  
  479.     movem.l    D0/A6,-(sp)
  480.     lea    \2(pc),A6
  481.     move.l    \1,(A6)
  482.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  483.     ENDM
  484.  
  485. RELOC_MOVEW:MACRO
  486.     IFNE    NARG-2
  487.         FAIL    arguments "RELOC_MOVEW"
  488.     ENDC
  489.  
  490.     movem.l    A6/D0,-(sp)
  491.     lea    \2(pc),A6
  492.     move.w    \1,(A6)
  493.     movem.l    (sp)+,D0/A6
  494.     ENDM
  495.  
  496. RELOC_MOVEB:MACRO
  497.     IFNE    NARG-2
  498.         FAIL    arguments "RELOC_MOVEB"
  499.     ENDC
  500.  
  501.     movem.l    A6/D0,-(sp)
  502.     lea    \2(pc),A6
  503.     move.b    \1,(A6)
  504.     movem.l    (sp)+,D0/A6
  505.     ENDM
  506.  
  507. RELOC_ADDL:MACRO
  508.     IFNE    NARG-2
  509.         FAIL    arguments "RELOC_ADDL"
  510.     ENDC
  511.  
  512.     movem.l    D0/A6,-(sp)
  513.     lea    \2(pc),A6
  514.     add.l    \1,(A6)
  515.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  516.     ENDM
  517.  
  518. RELOC_ADDW:MACRO
  519.     IFNE    NARG-2
  520.         FAIL    arguments "RELOC_ADDW"
  521.     ENDC
  522.  
  523.     movem.l    A6/D0,-(sp)
  524.     lea    \2(pc),A6
  525.     add.w    \1,(A6)
  526.     movem.l    (sp)+,D0/A6
  527.     ENDM
  528.  
  529. RELOC_ADDB:MACRO
  530.     IFNE    NARG-2
  531.         FAIL    arguments "RELOC_ADDB"
  532.     ENDC
  533.  
  534.     movem.l    A6/D0,-(sp)
  535.     lea    \2(pc),A6
  536.     add.b    \1,(A6)
  537.     movem.l    (sp)+,D0/A6
  538.     ENDM
  539.  
  540.  
  541. RELOC_SUBL:MACRO
  542.     IFNE    NARG-2
  543.         FAIL    arguments "RELOC_SUBL"
  544.     ENDC
  545.  
  546.     movem.l    D0/A6,-(sp)
  547.     lea    \2(pc),A6
  548.     sub.l    \1,(A6)
  549.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  550.     ENDM
  551.  
  552. RELOC_SUBW:MACRO
  553.     IFNE    NARG-2
  554.         FAIL    arguments "RELOC_SUBW"
  555.     ENDC
  556.  
  557.     movem.l    A6/D0,-(sp)
  558.     lea    \2(pc),A6
  559.     sub.w    \1,(A6)
  560.     movem.l    (sp)+,D0/A6
  561.     ENDM
  562.  
  563. RELOC_SUBB:MACRO
  564.     IFNE    NARG-2
  565.         FAIL    arguments "RELOC_SUBB"
  566.     ENDC
  567.  
  568.     movem.l    A6/D0,-(sp)
  569.     lea    \2(pc),A6
  570.     sub.b    \1,(A6)
  571.     movem.l    (sp)+,D0/A6
  572.     ENDM
  573.  
  574. RELOC_TSTL:MACRO
  575.     IFNE    NARG-1
  576.         FAIL    arguments "RELOC_TSTL"
  577.     ENDC
  578.  
  579.     movem.l    D0/A0,-(sp)
  580.     lea    \1(pc),A0
  581.     tst.l    (A0)
  582.     movem.l    (sp)+,D0/A0
  583.     ENDM
  584.  
  585. RELOC_TSTW:MACRO
  586.     IFNE    NARG-1
  587.         FAIL    arguments "RELOC_TSTW"
  588.     ENDC
  589.  
  590.     movem.l    D0/A0,-(sp)
  591.     lea    \1(pc),A0
  592.     tst.w    (A0)
  593.     movem.l    (sp)+,D0/A0
  594.     ENDM
  595.  
  596. RELOC_TSTB:MACRO
  597.     IFNE    NARG-1
  598.         FAIL    arguments "RELOC_TSTB"
  599.     ENDC
  600.  
  601.     movem.l    D0/A0,-(sp)
  602.     lea    \1(pc),A0
  603.     tst.b    (A0)
  604.     movem.l    (sp)+,D0/A0
  605.     ENDM
  606.  
  607.     ; *** builds the function offsets
  608.  
  609.     MAKE_ABS_REFS    OFFSET
  610.     MAKE_REL_REFS    OFFSET
  611.  
  612.  
  613. HDP_SAFETY = $00
  614. HDP_MAGIC = $04
  615. HDP_VERSION = $08
  616. HDP_ABSTABLE = $0C
  617. HDP_RELTABLE = $10
  618. HDP_FILESIZE = $14
  619. HDP_NBDISKS = $18
  620. HDP_ENTRY = $1C
  621. HDP_FNAME = $20
  622. HDP_SYSBASE = $24
  623. HDP_DOSBASE = $28
  624.  
  625. OBJ_NONE = 0
  626. OBJ_FILE = 1
  627. OBJ_DIR = 2
  628.  
  629.  
  630.     ENDC
  631.  
  632.